let stage;
let text;
let circle;
let displayStatus;

window.onload = function() {
	stage = new createjs.Stage("canvas");
	text = new createjs.Text("hello", "36px Arial", "#777");
	stage.addChild(text);
	stage.update(); 

	stage.x = 100;
	stage.y = 100;
	
	circle = new createjs.Shape();
	circle.graphics.beginFill("#00ff00").drawCircle(0, 0, 50);
	stage.addChild(circle);
	createjs.Tween.get(circle, {
			loop: true
		})
		.wait(1000)
		.to({
			scaleX: 0.2,
			scaleY: 0.2
		})
		.wait(1000)
		.to({
			scaleX: 1,
			scaleY: 1
		}, 100, createjs.Ease.bounceInOut());
	createjs.Ticker.setFPS(20);
	createjs.Ticker.addEventListener("tick", stage);
	
	displayStatus = document.getElementById("status");
	let src = "raw/a.mp3";
	createjs.Sound.alternateExtensions = ["mp3"];
	createjs.Sound.addEventListener("fileload",playSound);
	createjs.Sound.registerSound(src);
	
	displayStatus.innerHTML = "等待";

}

function playSound(event){
	soundInstance = createjs.Sound.play(event.src);
	displayStatus.innerHTML = event.src;
}
